//
//  TZTabBarVC.swift
//  SimpleTZ
//
//  Created by wangfeng on 2020/7/9.
//  Copyright © 2020 davis. All rights reserved.
//

import UIKit

class TZTabBarVC: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        setTabBarBackColor()
        addTabBarItems()

        // Do any additional setup after loading the view.
    }
    
    func setTabBarBackColor(){
        tabBar.backgroundImage = ImageWithColor(color: .white)
        tabBar.shadowImage = IMG(name: "tabbar_shadow")
        tabBar.isOpaque = true
        tabBar.tintColor = UIColorFromHX(rgbValue: 0x1393fc)
        tabBar.isTranslucent = false
    }
    
    func addTabBarItems() {
        for dict in TZFactory.createClassByPlistName(name: "TabBarItem", type: "plist") as! [NSDictionary] {
            let VC = dict[ClassClass] as! TZBaseVC
            let navc = TZBaseNavC(rootViewController: VC)
            navc.tabBarItem.image = IMG(name: dict[ClassImageName] as! String)
            navc.tabBarItem.selectedImage = IMG(name: dict[SelectImage] as! String)
            navc.tabBarItem.title = dict[TitleVC] as? String
            VC.title = dict[TitleVC] as? String
            addChild(navc)
        }
    }


}
